using System;
using System.Collections;
using Oracle.ManagedDataAccess.Client;
using OracleInternal.Common;

namespace OracleInternal.TTC
{
	internal class TTCClose : TTCFunction
	{
		internal TTCClose(MarshallingEngine mEngine)
			: base(mEngine, 105, 0)
		{
			m_ttcCode = 17;
		}

		internal void Write(ArrayList cursorIdList)
		{
			if (ProviderConfig.m_bTraceLevelPrivate)
			{
				Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131328, OracleTraceClassName.TTCClose, OracleTraceFuncName.Write);
			}
			try
			{
				WriteFunctionHeader();
				int count = cursorIdList.Count;
				m_marshallingEngine.MarshalPointer();
				m_marshallingEngine.MarshalUB4(count);
				for (int i = 0; i < count; i++)
				{
					m_marshallingEngine.MarshalUB4(Convert.ToInt64(cursorIdList[i]));
				}
			}
			catch (Exception ex)
			{
				OracleException.HandleError(OracleTraceLevel.Private, (OracleTraceTag)268566528, OracleTraceClassName.TTCClose, OracleTraceFuncName.Write, ex);
				throw;
			}
			finally
			{
				if (ProviderConfig.m_bTraceLevelPrivate)
				{
					Trace.Write(OracleTraceLevel.Private, (OracleTraceTag)131584, OracleTraceClassName.TTCClose, OracleTraceFuncName.Write);
				}
			}
		}
	}
}
